import request from "../utils/request";

export const login = (phone, password) => {
  console.log(phone, password);
  return request({
    method: "POST",
    url: `/user/passport/login`,
    data: {
      phone,
      password,
    },
  });
};

export const logout = () => {
  return request({
    method: "GET",
    url: "/user/passport/logout",
  });
};

export const getCode = (phone) => {
  return request({
    method: "GET",
    url: `/user/passport/sendCode/${phone}`,
  });
};

export const register = (phone, password, code) => {
  return request({
    method: "post",
    url: `/user/passport/register`,
    data: {
      phone,
      password,
      code,
    },
  });
};
